﻿using System;
using System.Collections.Generic;
using System.Windows.Forms;
using Lottery.App.BLL;

namespace UI
{
    public partial class Tool : Form
    {
        private class NameValue
        {
            public string Name { get; set; }

            public int Value { get; set; }

            public NameValue(string name, int value)
            {
                Name = name;
                Value = value;
            }
        }

        public Tool()
        {
            InitializeComponent();

            List<NameValue> list = new List<NameValue>();

            list.Add(new NameValue("数投", 24));
            list.Add(new NameValue("红投", 8));
            list.Add(new NameValue("连二组", 31));
            list.Add(new NameValue("连二直", 62));
            list.Add(new NameValue("前三组", 1300));
            list.Add(new NameValue("前三直", 8000));
            list.Add(new NameValue("任选二", 8));
            list.Add(new NameValue("任选三", 24));
            list.Add(new NameValue("任选四", 80));
            list.Add(new NameValue("任选五", 320));

            comboBonus.DataSource = list;
            comboBonus.DisplayMember = "Name";
            comboBonus.ValueMember = "Value";
            comboBonus.SelectedIndex = 0;
        }

        private void btnCalc_Click(object sender, EventArgs e)
        {
            int money = (int)txtMoney.Value;
            int bonus = Convert.ToInt32(comboBonus.SelectedValue);
            int count = (int)txtCount.Value;
            int bs = (int)txtRedouble.Value;
            int profit = (int)txtProfit.Value;

            if (money <= 0 || bonus <= 0) return; //数据检查
            

            dataGridView1.DataSource = new InvestManager(money, bonus, count, bs, profit).GetResult();
            dataGridView1.Rows[0].Selected = false;
        }








    }
}
